**Clean wave 4 V2"
clear all

**Import raw data
import spss using "RAW_wave4.sav", clear

***NOTE: variables are labeled with "4" to define them as taking place in wave 4 of the survey

**Rename and define education variable
rename educ educ4
label define educ_label 1 "No HS" 2 "High school graduate" 3 "Some college" 4 "2-year" 5 "4-year" 6 "Post-grad"
label values educ4 educ_label

*Designate weight for wave 4
rename weight weight4

**Define and label household size
rename q1 hhsize4
label define hhsizelabel 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8" 9 "9" 10 "10" 11 "11" 12 "12" 13 "13" 14 "14" 15 "15" 16 "16" 17 "17" 18 "18" 19 "19" 20 "20"
label values hhsize4 hhsizelabel

**Define and label number of children under 5 in the household
rename q2_a hh_under54
recode hh_under54 (1=0) (2=1) (3=2) (4=3) (5=4)
label define hhunder5label 0 "0" 1 "1" 2 "2" 3 "3" 4 "More than 3"
label values hh_under54 hhunder5label

**Define and label number of people over 65 in the household
gen hh_over654=.
replace hh_over654=0 if q2_b==1
replace hh_over654=1 if q2_b==2
replace hh_over654=2 if q2_b==3
replace hh_over654=3 if q2_b==4
replace hh_over654=4 if q2_b==5
label define hh_over65_label 0 "0" 1 "1" 2 "2" 3 "3" 4 "more than 3"
label val hh_over654 hh_over65_label
drop q2_b


**Define and label number of people with disability in the household
gen hh_disability4=.
replace hh_disability4=0 if q2_c==1
replace hh_disability4=1 if q2_c==2
replace hh_disability4=2 if q2_c==3
replace hh_disability4=3 if q2_c==4
replace hh_disability4=4 if q2_c==5
label define hh_disability_label 0 "0" 1 "1" 2 "2" 3 "3" 4 "more than 3"
label val hh_disability4 hh_disability_label
drop q2_c


**Did respondent move between wave 2 and wave 3, and if so what is their new dwelling type?
rename q4 moved
rename q6 dwelling_moved4
rename q6_open dwelling_open4

gen dwelling_type4=.
replace dwelling_type4=1 if dwelling_moved4 ==1
replace dwelling_type4=2 if dwelling_moved4 ==2
replace dwelling_type4=3 if dwelling_moved4 ==3
replace dwelling_type4=4 if dwelling_moved4 ==4
replace dwelling_type4=5 if dwelling_moved4 ==9
label var dwelling_type4 "Dwelling Type"
label define dwelling_typelabel 1 "Trailer or mobile home" 2 "Apartment/duplex/condominum" 3 "Detached, single family home" 4 "Attached single family home" 5 "Other"
label values dwelling_type4 dwelling_typelabel


rename q72_1 hh1_income4
rename q72_2 hh2_income4
rename q72_3 hh3_income4
rename q72_4 hh4_income4
rename q72_5 hh5_income4
rename q72_6 hh6_income4
rename q72_7 hh7_income4
rename q72_8 hh8_income4
rename q72_all income4


**Renaming responses to dwelling conditions (e.g., household deficiencies), then cleaning responses
***NOTE: these responses are only for respondents who moved***
rename q7_1 poor_insulation4
rename q7_2 drafty4
rename q7_3 mold4
rename q7_4 holes4
rename q7_5 plumbing4
rename q7_6 exposed_sockets4
rename q7_7 nonworking_stove_fridge4
rename q7_8 broken_heating4
rename q7_9 broken_ac4

replace poor_insulation4=0 if poor_insulation4 !=1
label define poorinsulation_label 0 "no" 1 "yes"
label values poor_insulation4 poorinsulation_label

replace drafty4=0 if drafty4 !=1
label define drafty_label 0 "no" 1 "yes"
label values drafty4 drafty_label

replace mold4=0 if mold4 !=1
label define mold_label 0 "no" 1 "yes"
label values mold4 mold_label

replace holes4=0 if holes4 !=1
label define holes_label 0 "no" 1 "yes"
label values holes4 holes_label

replace plumbing4=0 if plumbing4 !=1
label define plumbing_label 0 "no" 1 "yes"
label values plumbing4 plumbing_label

replace exposed_sockets4=0 if exposed_sockets4 !=1
label define exposed_sockets_label 0 "no" 1 "yes"
label values exposed_sockets4 exposed_sockets_label

replace nonworking_stove_fridge4=0 if nonworking_stove_fridge4 !=1
label define nonworking_stove_label 0 "no" 1 "yes"
label values nonworking_stove_fridge4 nonworking_stove_label

replace broken_heating4=0 if broken_heating4 !=1
label define broken_heating_label 0 "no" 1 "yes"
label values broken_heating4 broken_heating_label

replace broken_ac4=0 if broken_ac4 !=1
label define broken_ac_label 0 "no" 1 "yes"
label values broken_ac4 broken_ac_label

***Binary variable representing if a respondent indicated they had poor insulation, drafty air in their home, mold, holes, bad plumbing, exposed sockets, a stove or fridge that isn't currently working, or broken AC or heating
gen dwelling_condition4=.

replace dwelling_condition4=0 if poor_insulation4==0 & drafty4==0 & mold4==0 & holes4==0 & plumbing4==0 & exposed_sockets4==0 & nonworking_stove_fridge4==0 & broken_heating4==0 & broken_ac4==0

replace dwelling_condition4=1 if poor_insulation4==1 | drafty4==1 | mold4==1 | holes4==1 | plumbing4==1 | exposed_sockets4==1 |nonworking_stove_fridge4==1 | broken_heating4==1 | broken_ac4==1

label define dwelling_conditionlabel 0 "No dwelling conditions" 1 "At least 1 dwelling condition"
label values dwelling_condition4 dwelling_conditionlabel


**Fuel type that household uses for energy (electricity, gas, wood, propane, or fuel oil)
***NOTE: these responses are only for respondents who moved***
rename q8_1 electricity4
rename q8_2 gas4
rename q8_3 wood4
rename q8_4 propane4
rename q8_5 fueloil4

**respondents rating of trust in their electricity provider
rename q10 trust_energyco4
label define trust_label 0 "0 - Don't trust electricity company at all" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8" 9 "9" 10 "10 - Fully trust electricity company"
label values trust_energyco4 trust_label

** Who pays for household fuel? Options: household pays all, all included in rent, some are paid by the household, some included in rent
gen fuel_payment4=.
replace fuel_payment4=1 if q11_1==1 | q11_2==1 | q11_3==1 | q11_4==1 | q11_5==1
replace fuel_payment4=2 if q11_1==2 | q11_2==2 | q11_3==2 | q11_4==2 | q11_5==2
replace fuel_payment4=3 if q11_1==3 | q11_2==3 | q11_3==3 | q11_4==3 | q11_5==3
replace fuel_payment4=4 if q11_1==4 | q11_2==4 | q11_3==4 | q11_4==4 | q11_5==4
replace fuel_payment4=5 if q11_1==9 | q11_2==9 | q11_3==9 | q11_4==9 | q11_5==9
label var fuel_payment4 "Fuel Payment"
label define fuel_paymentlabel 0 "None" 1 "Household pays all" 2 "All included in Rent" 3 "Some household, some rent" 4 "Other" 5 "Don't know/not asked"
label values fuel_payment4 fuel_paymentlabel


gen electricity_payment=0
replace electricity_payment=1 if q11_1==1
replace electricity_payment=2 if q11_1==2
replace electricity_payment=3 if q11_1==3
replace electricity_payment=4 if q11_1==4
label var electricity_payment "Electricity Payment"
label define electricity_paymentlabel 0 "None" 1 "Household pays all" 2 "All included in Rent" 3 "Some household, some rent"
label values electricity_payment electricity_paymentlabel

gen gas_payment=0
replace gas_payment=1 if q11_2==1
replace gas_payment=2 if q11_2==2
replace gas_payment=3 if q11_2==3
replace gas_payment=4 if q11_2==4
label var gas_payment "Gas Payment"
label define gas_paymentlabel 0 "None" 1 "Household pays all" 2 "All included in Rent" 3 "Some household, some rent"
label values gas_payment gas_paymentlabel

gen wood_payment=0
replace wood_payment=1 if q11_3==1
replace wood_payment=2 if q11_3==2
label var wood_payment "Wood Payment"
label define wood_paymentlabel 0 "None" 1 "Household pays all" 2 "All included in Rent"
label values wood_payment wood_paymentlabel

gen propane_payment=0
replace propane_payment=1 if q11_4==1
label var propane_payment "Propane Payment"
label define propane_paymentlabel 0 "None" 1 "Househodl pays all"
label values propane_payment propane_payment label

drop q11_1 q11_2 q11_3 q11_4

**are respondents' recent energy bills less than, more than, are about the same amount as a typical month
rename q12 energybill_change4

**does respondent own their home?
rename ownhome ownhome4

gen homeowner4 = .
replace homeowner4 = 0 if ownhome4 ==2 | ownhome4 ==3
replace homeowner4 = 1 if ownhome4 ==1
label var homeowner4 "own home?"
label define homeownerlabel 0 "no" 1 "yes"
label values homeowner4 homeownerlabel

**Does a household member require the use of an at-home electronic device?
rename q13 electronic_device4
recode electronic_device4 (2=0)
label define device4_label 0 "no" 1 "yes"
label values electronic_device4 device4_label

**Has household installed energy efficient appliances to keep their energy prices lower?
rename q14_1 efficient_appliances4
recode efficient_appliances4 (2=0)
label define appliance_label 0 "no" 1 "yes"
label values efficient_appliances4 appliance_label
rename q14_2 efficient_insulation4
recode efficient_insulation4 (2=0)
label define insulation_label 0 "no" 1 "yes"
label values efficient_insulation4 insulation_label
rename q14_3 efficient_ac4
recode efficient_ac4 (2=0)
label define ac_label 0 "no" 1 "yes"
label values efficient_ac4 ac_label
rename q14_4 efficient_smartmeter4
recode efficient_smartmeter4 (2=0)
label define smartmeter_label 0 "no" 1 "yes"
label values efficient_smartmeter4 smartmeter_label
rename q14_5 efficient_lights4
recode efficient_lights4 (2=0)
label define lights_label 0 "no" 1 "yes"
label values efficient_lights4 lights_label
rename q14_6 efficient_hometemp4
recode efficient_hometemp4 (2=0)
label define hometemp_label 0 "no" 1 "yes"
label values efficient_hometemp4 hometemp_label
rename q14_7 efficient_devices4
recode efficient_devices4 (2=0)
label define devices_label 0 "no" 1 "yes"
label values efficient_devices4 devices_label
rename q14_8 efficient_hungwindow4
recode efficient_hungwindow4 (2=0)
label define hungwindow_label 0 "no" 1 "yes"
label values efficient_hungwindow4 hungwindow_label


***Could not pay household energy bill in the last 4 months and from which source
rename q15 hhbill_4months
recode hhbill_4months (2=0)
label define hhbill_4mo_label 0 "no" 1 "yes"
label values hhbill_4months hhbill_4mo_label

gen hhbill_february=0
replace hhbill_february=1 if q16_1==1

gen hhbill_march=0
replace hhbill_march=1 if q16_2==1

gen hhbill_april=0
replace hhbill_april=1 if q16_3==1

gen hhbill_may2=0
replace hhbill_may2=1 if q16_4==1


drop q16_1 q16_2 q16_3 q16_4

gen hhbill_source_electric=0
replace hhbill_source_electric=1 if q17_1==1

gen hhbill_source_natgas=0
replace hhbill_source_natgas=1 if q17_2==1

gen hhbill_source_fuel=0
replace hhbill_source_fuel=1 if q17_3==1

drop q17_1 q17_2 q17_3


**did household receive a disconnection notice in last 4 months and from which source
rename q18 notice_4months
recode notice_4months (2=0)
label define notice_4mo_label 0 "no" 1 "yes"
label values notice_4months notice_4mo_label


gen notice_february=0
replace notice_february=1 if q19_1==1

gen notice_march=0
replace notice_march=1 if q19_2==1

gen notice_april=0
replace notice_april=1 if q19_3==1

gen notice_may2=0
replace notice_may2=1 if q19_4==1


drop q19_1 q19_2 q19_3 q19_4


gen notice_source_electric=0
replace notice_source_electric=1 if q20_1==1

gen notice_source_natgas=0
replace notice_source_natgas=1 if q20_2==1

gen notice_source_fuel=0
replace notice_source_fuel=1 if q20_3==1

drop q20_1 q20_2 q20_3




**did household get disconnected in last 4 months and from which source
gen disconnect_4months=0
replace disconnect_4months=1 if q21==1
recode disconnect_4months (2=0)
label define disconnect_4mo_label 0 "no" 1 "yes"
label values disconnect_4months disconnect_5mo_label

drop q21

gen disconnect_february=0
replace disconnect_february=1 if q22_1==1

gen disconnect_march=0
replace disconnect_march=1 if q22_2==1

gen disconnect_april=0
replace disconnect_april=1 if q22_3==1

gen disconnect_may2=0
replace disconnect_may2=1 if q22_2==1

drop q22_1 q22_2 q22_3 q22_4


gen disconnect_source_electric=0
replace disconnect_source_electric=1 if q23_1==1

gen disconnect_source_natgas=0
replace disconnect_source_natgas=1 if q23_2==1

gen disconnect_source_fuel=0
replace disconnect_source_fuel=1 if q23_3==1

drop q23_1 q23_2 q23_3


**if a respondent recieved a disconnection notice, in which form did that notice arrive (a call, a letter, a door knock, an email, or a text?)
rename q24_1 form_call4
recode form_call4 (2=0)
label define form_call4_label 0 "no" 1 "yes"
label values form_call4 form_call4_label
rename q24_2 form_letter4
recode form_letter4 (2=0)
label define form_letter4_label 0 "no" 1 "yes"
label values form_letter4 form_letter4_label
rename q24_3 form_doorknock4
recode form_doorknock4 (2=0)
label define form_doorknock4_label 0 "no" 1 "yes"
label values form_doorknock4 form_doorknock4_label
rename q24_4 form_email4
recode form_email4 (2=0)
label define form_email4_label 0 "no" 1 "yes"
label values form_email4 form_email4_label
rename q24_5 form_text4
recode form_text4 (2=0)
label define form_text4_label 0 "no" 1 "yes"
label values form_text4 form_text4_label


**if a respondent recieved a disconnection notice, how did they respond (contacted utility, set up a payment plan, sought legal service, sought government assistance, searched online for solutions, made changes to reduce energy consumption, or moved?)
rename q25_1 response_contactutility4
recode response_contactutility4 (2=0)
label define response_contact_label 0 "no" 1 "yes"
label values response_contactutility4 response_contact_label
rename q25_2 response_paymentplan4
recode response_paymentplan4 (2=0)
label define response_paymentplan_label 0 "no" 1 "yes"
label values response_paymentplan4 response_paymentplan_label
rename q25_3 response_legalservices4
recode response_legalservices4 (2=0)
label define response_legalservices_label 0 "no" 1 "yes"
label values response_legalservices4 response_legalservices_label
rename q25_4 response_assistance4
recode response_assistance4 (2=0)
label define response_assistance_label 0 "no" 1 "yes"
label values response_assistance4 response_assistance_label
rename q25_5 response_internet4
recode response_internet4 (2=0)
label define response_internet_label 0 "no" 1 "yes"
label values response_internet4 response_internet_label
rename q25_6 response_homechanges4
recode response_homechanges4 (2=0)
label define response_homechanges_label 0 "no" 1 "yes"
label values response_homechanges4 response_homechanges_label
rename q25_7 response_reduceenergy4
recode response_reduceenergy4 (2=0)
label define response_reduceenergy_label 0 "no" 1 "yes"
label values response_reduceenergy4 response_reduceenergy_label
rename q25_8 response_moved4
recode response_moved4 (2=0)
label define response_moved_label 0 "no" 1 "yes"
label values response_moved4 response_moved_label


**if a respondent received a disconnection notice, did they seek help from the following sources (a government agency, a bank, a payday loan service, their utility, a non profit, a faith based organization, or friends/family members?)
rename q26_1 sought_govagency4
recode sought_govagency4 (2=0)
label define sought_agency4_label 0 "no" 1 "yes"
label values sought_govagency4 sought_agency4_label
rename q26_2 sought_bank4
recode sought_bank4 (2=0)
label define sought_bank4_label 0 "no" 1 "yes"
label values sought_bank4 sought_bank4_label
rename q26_3 sought_payday4
recode sought_payday4 (2=0)
label define sought_payday4_label 0 "no" 1 "yes"
label values sought_payday4 sought_payday4_label
rename q26_4 sought_utility4
recode sought_utility4 (2=0)
label define sought_utility4_label 0 "no" 1 "yes"
label values sought_utility4 sought_utility4_label
rename q26_5 sought_nonprofit4
recode sought_nonprofit4 (2=0)
label define sought_nonprofit4_label 0 "no" 1 "yes"
label values sought_nonprofit4 sought_nonprofit4_label
rename q26_6 sought_faithbased4
recode sought_faithbased4 (2=0)
label define sought_faithbased4_label 0 "no" 1 "yes"
label values sought_faithbased4 sought_faithbased4_label
rename q26_7 sought_family_friends4
recode sought_family_friends4 (2=0)
label define sought_family_friends4_label 0 "no" 1 "yes"
label values sought_family_friends4 sought_family_friends4_label


**did the respondent receive the help they sought
rename q27 received_assistance4
recode received_assistance4 (2=0)
label define received_assistance4_label 0 "no" 1 "yes"
label values received_assistance4 received_assistance4_label


**when a respondent was disconnected, how did they respond (moved temporarily/permanently, lived without electricity, got helped from someone other than the utility company, paid off their bill, used an alternative energy source, used their car or a batter for energy?)
rename q28_1 response_moved_temp4
recode response_moved_temp4 (2=0)
label define response_moved_temp_label 0 "no" 1 "yes"
label values response_moved_temp4 response_moved_temp_label
rename q28_2 response_moved_perm4
recode response_moved_perm4 (2=0)
label define response_moved_perm_label 0 "no" 1 "yes"
label values response_moved_perm4 response_moved_perm_label
rename q28_3 response_livedwithout4
recode response_livedwithout4 (2=0)
label define response_livedwithout_label 0 "no" 1 "yes"
label values response_livedwithout4 response_livedwithout_label
rename q28_4 response_otherhelp4
recode response_otherhelp4 (2=0)
label define response_otherhelp_label 0 "no" 1 "yes"
label values response_otherhelp4 response_otherhelp_label
rename q28_5 response_paidoff4
recode response_paidoff4 (2=0)
label define response_paidoff_label 0 "no" 1 "yes"
label values response_paidoff4 response_paidoff_label
rename q28_6 response_usedothers4
recode response_usedothers4 (2=0)
label define response_usedothers_label 0 "no" 1 "yes"
label values response_usedothers4 response_usedothers_label
rename q28_7 response_carorbattery4
recode response_carorbattery4 (2=0)
label define response_carorbattery_label 0 "no" 1 "yes"
label values response_carorbattery4 response_carorbattery_label



**For respondents who were disconnected, how much was the reconnection fee to get service turned back on
rename q29 reconnection_cost4


**did a respondent receieve assistance in paying their energy bill in the last 4 months from the following sources: government agency, their energy provider, a friend or family member, a faith-based organization, a nonprofit, a payday lender, or a bank loan
rename q30_1 gov_agency_4mos
rename q30_2 energy_provider_4mos
rename q30_3 friend_family_4mos
rename q30_4 faith_org_4mos
rename q30_5 nonprofit_4mos
rename q30_6 payday_lender_4mos
rename q30_7 bankloan_4mos

replace gov_agency_4mos=0 if gov_agency_4mos !=1
label define gov_agency_4label 0 "no" 1 "yes"
label values gov_agency_4mos gov_agency_4label

replace energy_provider_4mos=0 if energy_provider_4mos !=1
label define energy_provider_4label 0 "no" 1 "yes"
label values energy_provider_4mos energy_provider_4label

replace friend_family_4mos=0 if friend_family_4mos !=1
label define friend_family_4label 0 "no" 1 "yes"
label values friend_family_4mos friend_family_4label

replace faith_org_4mos=0 if faith_org_4mos !=1
label define faith_org_4label 0 "no" 1 "yes"
label values faith_org_4mos faith_org_4label

replace nonprofit_4mos=0 if nonprofit_4mos !=1
label define nonprofit_4label 0 "no" 1 "yes"
label values nonprofit_4mos nonprofit_4label

replace payday_lender_4mos=0 if payday_lender_4mos !=1
label define payday_lender_4label 0 "no" 1 "yes"
label values payday_lender_4mos payday_lender_4label

replace bankloan_4mos=0 if bankloan_4mos !=1
label define bankloan_4label 0 "no" 1 "yes"
label values bankloan_4mos bankloan_4label


**Binary variable indicating if a respondent received assistance paying their energy bill in the last 4 months
gen energy_assistance_4mos=.

replace energy_assistance_4mos=0 if gov_agency_4mos==0 & energy_provider_4mos==0 & friend_family_4mos==0 & faith_org_4mos==0 & nonprofit_4mos==0 & payday_lender_4mos==0 & bankloan_4mos==0

replace energy_assistance_4mos=1 if gov_agency_4mos==1 | energy_provider_4mos==1 | friend_family_4mos==1 | faith_org_4mos==1 | nonprofit_4mos==1 | payday_lender_4mos==1 | bankloan_4mos==1

label define energy_assist4label 0 "No assistance" 1 "Assistance from at least one source"
label values energy_assistance_4mos energy_assist4label




**did a respondent receieve assistance in paying their energy bill in February from the following sources: government agency, their energy provider, a friend or family member, a faith-based organization, a nonprofit, a payday lender, or a bank loan
rename q31a_1 gov_agency_february
rename q31b_1 energy_provider_february
rename q31c_1 friend_family_february
rename q31d_1 faith_org_february
rename q31e_1 nonprofit_february
rename q31f_1 payday_lender_february
rename q31g_1 bankloan_february



replace gov_agency_february=0 if gov_agency_february !=1
label define gov_agency_februarylabel 0 "no" 1 "yes"
label values gov_agency_february gov_agency_februarylabel

replace energy_provider_february=0 if energy_provider_february !=1
label define energy_provider_februarylabel 0 "no" 1 "yes"
label values energy_provider_february energy_provider_februarylabel

replace friend_family_february=0 if friend_family_february !=1
label define friend_family_februarylabel 0 "no" 1 "yes"
label values friend_family_february friend_family_februarylabel

replace faith_org_february=0 if faith_org_february !=1
label define faith_org_februarylabel 0 "no" 1 "yes"
label values faith_org_february faith_org_februarylabel

replace nonprofit_february=0 if nonprofit_february !=1
label define nonprofit_februarylabel 0 "no" 1 "yes"
label values nonprofit_february nonprofit_februarylabel

replace payday_lender_february=0 if payday_lender_february !=1
label define payday_lender_februarylabel 0 "no" 1 "yes"
label values payday_lender_february payday_lender_februarylabel

replace bankloan_february=0 if bankloan_february !=1
label define bankloan_februarylabel 0 "no" 1 "yes"
label values bankloan_february bankloan_februarylabel


**Binary variable indicating if a respondent received assistance paying their energy bill in February
gen energy_assistance_february=.

replace energy_assistance_february=0 if gov_agency_february==0 & energy_provider_february==0 & friend_family_february==0 & faith_org_february==0 & nonprofit_february==0 & payday_lender_february==0 & bankloan_february==0

replace energy_assistance_february=1 if gov_agency_february==1 | energy_provider_february==1 | friend_family_february==1 | faith_org_february==1 | nonprofit_february==1 | payday_lender_february==1 | bankloan_february==1

label define energy_assistFlabel 0 "No assistance" 1 "Assistance from at least one source"
label values energy_assistance_february energy_assistFlabel



**did a respondent receieve assistance in paying their energy bill in March from the following sources: government agency, their energy provider, a friend or family member, a faith-based organization, a nonprofit, a payday lender, or a bank loan
rename q31a_2 gov_agency_march
rename q31b_2 energy_provider_march
rename q31c_2 friend_family_march
rename q31d_2 faith_org_march
rename q31e_2 nonprofit_march
rename q31f_2 payday_lender_march
rename q31g_2 bankloan_march


replace gov_agency_march=0 if gov_agency_march !=1
label define gov_agency_marchlabel 0 "no" 1 "yes"
label values gov_agency_march gov_agency_marchlabel

replace energy_provider_march=0 if energy_provider_march !=1
label define energy_provider_marchlabel 0 "no" 1 "yes"
label values energy_provider_march energy_provider_marchlabel

replace friend_family_march=0 if friend_family_march !=1
label define friend_family_marchlabel 0 "no" 1 "yes"
label values friend_family_march friend_family_marchlabel

replace faith_org_march=0 if faith_org_march !=1
label define faith_org_marchlabel 0 "no" 1 "yes"
label values faith_org_march faith_org_marchlabel


replace nonprofit_march=0 if nonprofit_march !=1
label define nonprofit_marchlabel 0 "no" 1 "yes"
label values nonprofit_march nonprofit_marchlabel

replace payday_lender_march=0 if payday_lender_march !=1
label define payday_lender_marchlabel 0 "no" 1 "yes"
label values payday_lender_march payday_lender_marchlabel

replace bankloan_march=0 if bankloan_march !=1
label define bankloan_marchlabel 0 "no" 1 "yes"
label values bankloan_march bankloan_marchlabel


**Binary variable indicating if a respondent received assistance paying their energy bill in march
gen energy_assistance_march=.

replace energy_assistance_march=0 if gov_agency_march==0 & energy_provider_march==0 & friend_family_march==0 & faith_org_march==0 & nonprofit_march==0 & payday_lender_march==0 & bankloan_march==0

replace energy_assistance_march=1 if gov_agency_march==1 | energy_provider_march==1 | friend_family_march==1 | faith_org_march==1 | nonprofit_march==1 | payday_lender_march==1 | bankloan_march==1

label define energy_assistMlabel 0 "No assistance" 1 "Assistance from at least one source"
label values energy_assistance_march energy_assistMlabel



**did a respondent receieve assistance in paying their energy bill in April from the following sources: government agency, their energy provider, a friend or family member, a faith-based organization, a nonprofit, a payday lender, or a bank loan
rename q31a_3 gov_agency_april
rename q31b_3 energy_provider_april
rename q31c_3 friend_family_april
rename q31d_3 faith_org_april
rename q31e_3 nonprofit_april
rename q31f_3 payday_lender_april
rename q31g_3 bankloan_april

replace gov_agency_april=0 if gov_agency_april !=1
label define gov_agency_aprillabel 0 "no" 1 "yes"
label values gov_agency_april gov_agency_aprillabel

replace energy_provider_april=0 if energy_provider_april !=1
label define energy_provider_aprillabel 0 "no" 1 "yes"
label values energy_provider_april energy_provider_aprillabel

replace friend_family_april=0 if friend_family_april !=1
label define friend_family_aprillabel 0 "no" 1 "yes"
label values friend_family_april friend_family_aprillabel

replace faith_org_april=0 if faith_org_april !=1
label define faith_org_aprillabel 0 "no" 1 "yes"
label values faith_org_april faith_org_aprillabel

replace nonprofit_april=0 if nonprofit_april !=1
label define nonprofit_aprillabel 0 "no" 1 "yes"
label values nonprofit_april nonprofit_aprillabel

replace payday_lender_april=0 if payday_lender_april !=1
label define payday_lender_aprillabel 0 "no" 1 "yes"
label values payday_lender_april payday_lender_aprillabel

replace bankloan_april=0 if bankloan_april !=1
label define bankloan_aprillabel 0 "no" 1 "yes"
label values bankloan_april bankloan_aprillabel


**Binary variable indicating if a respondent received assistance paying their energy bill in april
gen energy_assistance_april=.

replace energy_assistance_april=0 if gov_agency_april==0 & energy_provider_april==0 & friend_family_april==0 & faith_org_april==0 & nonprofit_april==0 & payday_lender_april==0 & bankloan_april==0

replace energy_assistance_april=1 if gov_agency_april==1 | energy_provider_april==1 | friend_family_april==1 | faith_org_april==1 | nonprofit_april==1 | payday_lender_april==1 | bankloan_april==1

label define energy_assistAlabel 0 "No assistance" 1 "Assistance from at least one source"
label values energy_assistance_april energy_assistAlabel




**did a respondent receieve assistance in paying their energy bill in May from the following sources: government agency, their energy provider, a friend or family member, a faith-based organization, a nonprofit, a payday lender, or a bank loan
rename q31a_4 gov_agency_may2
rename q31b_4 energy_provider_may2
rename q31c_4 friend_family_may2
rename q31d_4 faith_org_may2
rename q31e_4 nonprofit_may2
rename q31f_4 payday_lender_may2
rename q31g_4 bankloan_may2

replace gov_agency_may2=0 if gov_agency_may2 !=1
label define gov_agency_may2label 0 "no" 1 "yes"
label values gov_agency_may2 gov_agency_may2label

replace energy_provider_may2=0 if energy_provider_may2 !=1
label define energy_provider_may2label 0 "no" 1 "yes"
label values energy_provider_may2 energy_provider_may2label

replace friend_family_may2=0 if friend_family_may2 !=1
label define friend_family_may2label 0 "no" 1 "yes"
label values friend_family_may2 friend_family_may2label

replace faith_org_may2=0 if faith_org_may2 !=1
label define faith_org_may2label 0 "no" 1 "yes"
label values faith_org_may2 faith_org_may2label

replace nonprofit_may2=0 if nonprofit_may2 !=1
label define nonprofit_may2label 0 "no" 1 "yes"
label values nonprofit_may2 nonprofit_may2label

replace payday_lender_may2=0 if payday_lender_may2 !=1
label define payday_lender_may2label 0 "no" 1 "yes"
label values payday_lender_may2 payday_lender_may2label

replace bankloan_may2=0 if bankloan_may2 !=1
label define bankloan_may2label 0 "no" 1 "yes"
label values bankloan_may2 bankloan_may2label


**Binary variable indicating if a respondent received assistance paying their energy bill in may
gen energy_assistance_may2=.

replace energy_assistance_may2=0 if gov_agency_may2==0 & energy_provider_may2==0 & friend_family_may2==0 & faith_org_may2==0 & nonprofit_may2==0 & payday_lender_may2==0 & bankloan_may2==0

replace energy_assistance_may2=1 if gov_agency_may2==1 | energy_provider_may2==1 | friend_family_may2==1 | faith_org_may2==1 | nonprofit_may2==1 | payday_lender_may2==1 | bankloan_may2==1

label define energy_assistMaylabel 0 "No assistance" 1 "Assistance from at least one source"
label values energy_assistance_may2 energy_assistMaylabel




**did respondent have to forgo basic household expenses to pay an energy bill in the last 4 months
gen forego_expenses_4mos=0
replace forego_expenses_4mos=1 if q32==1

gen forego_expenses_february=0
replace forego_expenses_february=1 if q33_1==1

gen forego_expenses_march=0
replace forego_expenses_march=1 if q33_2==1

gen forego_expenses_april=0
replace forego_expenses_april=1 if q33_3==1

gen forego_expenses_may2=0
replace forego_expenses_may2=1 if q33_4==1

drop q32 q33_1 q33_2 q33_3 q33_4


**did respondent receive WAP (Weatherization Assistance Program), LIHEAP (Low-Income Housing Energy Assistance Progam), SNAP, TANF, SSI, Medicaid, Veterans Benefits, Unemployment Insurance, and a COVID stimulus check in the last 4 months
rename q34_1 wap_4mos
rename q34_2 liheap_4mos
rename q34_3 snap_4mos
rename q34_4 tanf_4mos
rename q34_5 ssi_4mos
rename q34_6 medicaid_4mos
rename q34_7 medicare_4mos
rename q34_8 vet_benefits_4mos
rename q34_9 unemp_insurance_4mos


replace wap_4mos=0 if wap_4mos !=1
label define wap_4label 0 "no" 1 "yes"
label values wap_4mos wap_5label

replace liheap_4mos=0 if liheap_4mos !=1
label define liheap_4label 0 "no" 1 "yes"
label values liheap_4mos liheap_5label

replace snap_4mos=0 if snap_4mos !=1
label define snap_4label 0 "no" 1 "yes"
label values snap_4mos snap_5label

replace tanf_4mos=0 if tanf_4mos !=1
label define tanf_4label 0 "no" 1 "yes"
label values tanf_4mos tanf_5label

replace ssi_4mos=0 if ssi_4mos !=1
label define ssi_4label 0 "no" 1 "yes"
label values ssi_4mos ssi_5label

replace medicaid_4mos=0 if medicaid_4mos !=1
label define medicaid_4label 0 "no" 1 "yes"
label values medicaid_4mos medicaid_5label

replace vet_benefits_4mos=0 if vet_benefits_4mos !=1
label define vet_benefits_4label 0 "no" 1 "yes"
label values vet_benefits_4mos vet_benefits_5label

replace unemp_insurance_4mos=0 if unemp_insurance_4mos !=1
label define unemp_insurance_4label 0 "no" 1 "yes"
label values unemp_insurance_4mos unemp_insurance_5label

**Binary variable representing whether respondent received government assistance in the previous 4 months
gen gov_assistance_4months=.

replace gov_assistance_4months=0 if wap_4mos==0 & liheap_4mos==0 & snap_4mos==0 & tanf_4mos==0 & ssi_4mos==0 & medicaid_4mos==0 & vet_benefits_4mos==0 & unemp_insurance_4mos==0

replace gov_assistance_4months=1 if wap_4mos==1 | liheap_4mos==1 | snap_4mos==1 | tanf_4mos==1 | ssi_4mos==1 | medicaid_4mos==1 | vet_benefits_4mos==1 | unemp_insurance_4mos==1

label define gov_assist4monthslabel 0 "No assistance" 1 "Assistance from at least one source"
label values gov_assistance_4months gov_assist4monthslabel



**did respondent receive WAP (Weatherization Assistance Program), LIHEAP (Low-Income Housing Energy Assistance Progam), SNAP, TANF, SSI, Medicaid, Veterans Benefits, Unemployment Insurance, and a COVID stimulus check in February
rename q38a_1 wap_february
rename q38b_1 liheap_february
rename q38c_1 snap_february
rename q38d_1 tanf_february
rename q38e_1 ssi_february
rename q38f_1 medicaid_february
rename q38g_1 medicare_february
rename q38h_1 vet_benefits_february
rename q38i_1 unemp_insurance_february
rename q38j_1 stimulus_february


replace wap_february=0 if wap_february !=1
label define wap_februarylabel 0 "no" 1 "yes"
label values wap_february wap_februarylabel

replace liheap_february=0 if liheap_february !=1
label define liheap_februarylabel 0 "no" 1 "yes"
label values liheap_february liheap_februarylabel

replace snap_february=0 if snap_february !=1
label define snap_februarylabel 0 "no" 1 "yes"
label values snap_february snap_februarylabel

replace tanf_february=0 if tanf_february !=1
label define tanf_februarylabel 0 "no" 1 "yes"
label values tanf_february tanf_februarylabel

replace ssi_february=0 if ssi_february !=1
label define ssi_februarylabel 0 "no" 1 "yes"
label values ssi_february ssi_februarylabel

replace medicaid_february=0 if medicaid_february !=1
label define medicaid_februarylabel 0 "no" 1 "yes"
label values medicaid_february medicaid_februarylabel

replace vet_benefits_february=0 if vet_benefits_february !=1
label define vet_benefits_februarylabel 0 "no" 1 "yes"
label values vet_benefits_february vet_benefits_februarylabel

replace unemp_insurance_february=0 if unemp_insurance_february !=1
label define unemp_insurance_februarylabel 0 "no" 1 "yes"
label values unemp_insurance_february unemp_insurance_februarylabel


**Binary variable representing whether respondent received government assistance in February
gen gov_assistance_february=.

replace gov_assistance_february=0 if wap_4mos==0 & liheap_4mos==0 & snap_4mos==0 & tanf_4mos==0 & ssi_4mos==0 & medicaid_4mos==0 & vet_benefits_4mos==0 & unemp_insurance_4mos==0

replace gov_assistance_february=1 if wap_4mos==1 | liheap_4mos==1 | snap_4mos==1 | tanf_4mos==1 | ssi_4mos==1 | medicaid_4mos==1 | vet_benefits_4mos==1 | unemp_insurance_4mos==1

label define gov_assistfebruarylabel 0 "No assistance" 1 "Assistance from at least one source"
label values gov_assistance_february gov_assistfebruarylabel



**did respondent receive WAP (Weatherization Assistance Program), LIHEAP (Low-Income Housing Energy Assistance Progam), SNAP, TANF, SSI, Medicaid, Veterans Benefits, Unemployment Insurance, and a COVID stimulus check in March
rename q38a_2 wap_march
rename q38b_2 liheap_march
rename q38c_2 snap_march
rename q38d_2 tanf_march
rename q38e_2 ssi_march
rename q38f_2 medicaid_march
rename q38g_2 medicare_march
rename q38h_2 vet_benefits_march
rename q38i_2 unemp_insurance_march
rename q38j_2 stimulus_march


replace wap_march=0 if wap_march !=1
label define wap_marchlabel 0 "no" 1 "yes"
label values wap_march wap_marchlabel

replace liheap_march=0 if liheap_march !=1
label define liheap_marchlabel 0 "no" 1 "yes"
label values liheap_march liheap_marchlabel

replace snap_march=0 if snap_march !=1
label define snap_marchlabel 0 "no" 1 "yes"
label values snap_march snap_marchlabel

replace tanf_march=0 if tanf_march !=1
label define tanf_marchlabel 0 "no" 1 "yes"
label values tanf_march tanf_marchlabel

replace ssi_march=0 if ssi_march !=1
label define ssi_marchlabel 0 "no" 1 "yes"
label values ssi_march ssi_marchlabel

replace medicaid_march=0 if medicaid_march !=1
label define medicaid_marchlabel 0 "no" 1 "yes"
label values medicaid_march medicaid_marchlabel

replace vet_benefits_march=0 if vet_benefits_march !=1
label define vet_benefits_marchlabel 0 "no" 1 "yes"
label values vet_benefits_march vet_benefits_marchlabel

replace unemp_insurance_march=0 if unemp_insurance_march !=1
label define unemp_insurance_marchlabel 0 "no" 1 "yes"
label values unemp_insurance_march unemp_insurance_marchlabel



**Binary variable representing whether respondent received government assistance in march
gen gov_assistance_march=.

replace gov_assistance_march=0 if wap_4mos==0 & liheap_4mos==0 & snap_4mos==0 & tanf_4mos==0 & ssi_4mos==0 & medicaid_4mos==0 & vet_benefits_4mos==0 & unemp_insurance_4mos==0

replace gov_assistance_march=1 if wap_4mos==1 | liheap_4mos==1 | snap_4mos==1 | tanf_4mos==1 | ssi_4mos==1 | medicaid_4mos==1 | vet_benefits_4mos==1 | unemp_insurance_4mos==1

label define gov_assistmarchlabel 0 "No assistance" 1 "Assistance from at least one source"
label values gov_assistance_march gov_assistmarchlabel



**did respondent receive WAP (Weatherization Assistance Program), LIHEAP (Low-Income Housing Energy Assistance Progam), SNAP, TANF, SSI, Medicaid, Veterans Benefits, Unemployment Insurance, and a COVID stimulus check in April
rename q38a_3 wap_april
rename q38b_3 liheap_april
rename q38c_3 snap_april
rename q38d_3 tanf_april
rename q38e_3 ssi_april
rename q38f_3 medicaid_april
rename q38g_3 medicare_april
rename q38h_3 vet_benefits_april
rename q38i_3 unemp_insurance_april
rename q38j_3 stimulus_april

replace wap_april=0 if wap_april !=1
label define wap_aprillabel 0 "no" 1 "yes"
label values wap_april wap_aprillabel

replace liheap_april=0 if liheap_april !=1
label define liheap_aprillabel 0 "no" 1 "yes"
label values liheap_april liheap_aprillabel

replace snap_april=0 if snap_april !=1
label define snap_aprillabel 0 "no" 1 "yes"
label values snap_april snap_aprillabel


replace tanf_april=0 if tanf_april !=1
label define tanf_aprillabel 0 "no" 1 "yes"
label values tanf_april tanf_aprillabel

replace ssi_april=0 if ssi_april !=1
label define ssi_aprillabel 0 "no" 1 "yes"
label values ssi_april ssi_aprillabel

replace medicaid_april=0 if medicaid_april !=1
label define medicaid_aprillabel 0 "no" 1 "yes"
label values medicaid_april medicaid_aprillabel

replace vet_benefits_april=0 if vet_benefits_april !=1
label define vet_benefits_aprillabel 0 "no" 1 "yes"
label values vet_benefits_april vet_benefits_aprillabel

replace unemp_insurance_april=0 if unemp_insurance_april !=1
label define unemp_insurance_aprillabel 0 "no" 1 "yes"
label values unemp_insurance_april unemp_insurance_aprillabel


**Binary variable representing whether respondent received government assistance in april
gen gov_assistance_april=.

replace gov_assistance_april=0 if wap_4mos==0 & liheap_4mos==0 & snap_4mos==0 & tanf_4mos==0 & ssi_4mos==0 & medicaid_4mos==0 & vet_benefits_4mos==0 & unemp_insurance_4mos==0

replace gov_assistance_april=1 if wap_4mos==1 | liheap_4mos==1 | snap_4mos==1 | tanf_4mos==1 | ssi_4mos==1 | medicaid_4mos==1 | vet_benefits_4mos==1 | unemp_insurance_4mos==1

label define gov_assistaprillabel 0 "No assistance" 1 "Assistance from at least one source"
label values gov_assistance_april gov_assistaprillabel




**did respondent receive WAP (Weatherization Assistance Program), LIHEAP (Low-Income Housing Energy Assistance Progam), SNAP, TANF, SSI, Medicaid, Veterans Benefits, Unemployment Insurance, and a COVID stimulus check in May
rename q38a_4 wap_may2
rename q38b_4 liheap_may2
rename q38c_4 snap_may2
rename q38d_4 tanf_may2
rename q38e_4 ssi_may2
rename q38f_4 medicaid_may2
rename q38g_4 medicare_may2
rename q38h_4 vet_benefits_may2
rename q38i_4 unemp_insurance_may2
rename q38j_4 stimulus_may2

replace wap_may2=0 if wap_may2 !=1
label define wap_may2label 0 "no" 1 "yes"
label values wap_may2 wap_may2label

replace liheap_may2=0 if liheap_may2 !=1
label define liheap_may2label 0 "no" 1 "yes"
label values liheap_may2 liheap_may2label

replace snap_may2=0 if snap_may2 !=1
label define snap_may2label 0 "no" 1 "yes"
label values snap_may2 snap_may2label

replace tanf_may2=0 if tanf_may2 !=1
label define tanf_may2label 0 "no" 1 "yes"
label values tanf_may2 tanf_may2label

replace ssi_may2=0 if ssi_may2 !=1
label define ssi_may2label 0 "no" 1 "yes"
label values ssi_may2 ssi_may2label

replace medicaid_may2=0 if medicaid_may2 !=1
label define medicaid_may2label 0 "no" 1 "yes"
label values medicaid_may2 medicaid_may2label

replace vet_benefits_may2=0 if vet_benefits_may2 !=1
label define vet_benefits_may2label 0 "no" 1 "yes"
label values vet_benefits_may2 vet_benefits_may2label

replace unemp_insurance_may2=0 if unemp_insurance_may2 !=1
label define unemp_insurance_may2label 0 "no" 1 "yes"
label values unemp_insurance_may2 unemp_insurance_may2label


**Binary variable representing whether respondent received government assistance in may
gen gov_assistance_may2=.

replace gov_assistance_may2=0 if wap_4mos==0 & liheap_4mos==0 & snap_4mos==0 & tanf_4mos==0 & ssi_4mos==0 & medicaid_4mos==0 & vet_benefits_4mos==0 & unemp_insurance_4mos==0

replace gov_assistance_may2=1 if wap_4mos==1 | liheap_4mos==1 | snap_4mos==1 | tanf_4mos==1 | ssi_4mos==1 | medicaid_4mos==1 | vet_benefits_4mos==1 | unemp_insurance_4mos==1

label define gov_assistmay2label 0 "No assistance" 1 "Assistance from at least one source"
label values gov_assistance_may2 gov_assistmay2label




*Was respondent deemed ineligible for a government assistance program in which they applied
rename q35 assistance_ineligible4
recode assistance_ineligible4 (2=0)
label define assistance_ineligible4_label 0 "no" 1 "yes"
label values assistance_ineligible4 assistance_ineligible4_label



rename q36_1 ineligible_wap4
rename q36_2 ineligible_liheap4
rename q36_3 ineligible_snap4
rename q36_4 ineligible_tanf4
rename q36_5 ineligible_ssi4
rename q36_6 ineligible_medicaid4
rename q36_7 ineligible_medicare4
rename q36_8 ineligible_vet_benefits4
rename q36_9 ineligible_unemp_insurance4


gen ineligible_program4=0
replace ineligible_program4=1 if ineligible_wap4==1
replace ineligible_program4=2 if ineligible_liheap4==1
replace ineligible_program4=3 if ineligible_snap4==1
replace ineligible_program4=4 if ineligible_tanf4==1
replace ineligible_program4=5 if ineligible_ssi4==1
replace ineligible_program4=6 if ineligible_medicaid4==1
replace ineligible_program4=7 if ineligible_medicare4==1
replace ineligible_program4=8 if ineligible_vet_benefits4==1
replace ineligible_program4=9 if ineligible_unemp_insurance4==1
label var ineligible_program4 "Government Assistance Last Month"
label define ineligible_program4label 0 "None" 1 "WAP" 2 "LIHEAP" 3 "SNAP" 4 "TANF" 5 "SSI" 6 "Medicaid" 7 "Medicare" 8 "Veterans Benefits" 9 "Unemployment Insurance" 10 "COVID Stimulus"
label values ineligible_program4 ineligible_program4label

*why were they deemed inelligible?
rename q37 ineligible_reason4



**Did respondents receive each of the three stimulus checks
gen stimulus_4mos=0
replace stimulus_4mos=1 if stimulus_february==1 | stimulus_march==1 | stimulus_april==1 | stimulus_may2==1
label var stimulus_4mos "Received Stimulus?"
label define stimulus_label 0 "No" 1 "Yes"
label values stimulus_4mos stimulus_label


gen received_firststimulus=0
replace received_firststimulus=1 if Q_s1_1==1

gen received_secondstimulus=0
replace received_secondstimulus=1 if Q_s1_2==1

gen received_thirdstimulus=0
replace received_thirdstimulus=1 if Q_s1_3==1

gen received_nostimulus=0
replace received_nostimulus=1 if Q_s1_4==1




**Respondent used the following methods to stay warm in their home in the last 4 months
rename q39_1 stove_4mos
rename q39_2 spaceheater_4mos
rename q39_3 woodstove_4mos
rename q39_4 fireplace_4mos
rename q39_5 hotshower_4mos
rename q39_6 burntrash_4mos
rename q39_7 heavycoat_4mos
rename q39_8 dryer_4mos

replace stove_4mos=0 if stove_4mos !=1
label define stove_3label 0 "no" 1 "yes"
label values stove_4mos stove_3label

replace spaceheater_4mos=0 if spaceheater_4mos !=1
label define spaceheater_3label 0 "no" 1 "yes"
label values spaceheater_4mos spaceheater_3label

replace woodstove_4mos=0 if woodstove_4mos !=1
label define woodstove_3label 0 "no" 1 "yes"
label values woodstove_4mos woodstove_3label

replace fireplace_4mos=0 if fireplace_4mos !=1
label define fireplace_3label 0 "no" 1 "yes"
label values fireplace_4mos fireplace_3label

replace hotshower_4mos=0 if hotshower_4mos !=1
label define hotshower_3label 0 "no" 1 "yes"
label values hotshower_4mos hotshower_3label

replace burntrash_4mos=0 if burntrash_4mos !=1
label define burntrash_3label 0 "no" 1 "yes"
label values burntrash_4mos burntrash_3label

replace heavycoat_4mos=0 if heavycoat_4mos !=1
label define heavycoat_3label 0 "no" 1 "yes"
label values heavycoat_4mos heavycoat_3label

replace dryer_4mos=0 if dryer_4mos !=1
label define dryer_3label 0 "no" 1 "yes"
label values dryer_4mos dryer_3label

**binary variable representing whether a respondent used at least one strategy to stay warm in the last 4 months
gen staywarm_4mos=.

replace staywarm_4mos=0 if stove_4mos==0 & spaceheater_4mos==0 & woodstove_4mos==0 & fireplace_4mos==0 & hotshower_4mos==0 & burntrash_4mos==0 & heavycoat_4mos==0 & dryer_4mos==0


replace staywarm_4mos=1 if stove_4mos==1 | spaceheater_4mos==1 | woodstove_4mos==1 | fireplace_4mos==1 | hotshower_4mos==1 | burntrash_4mos==1 | heavycoat_4mos==1 | dryer_4mos==1


label define staywarm_4moslabel 0 "No coping strategies" 1 "At least one coping strategy"
label values staywarm_4mos staywarm_4moslabel



**Respondent used the following methods to stay cool in their home in the last 5 months
rename q40_1 centralac_4mos
rename q40_2 windowac_4mos
rename q40_3 fan_4mos
rename q40_4 dehumidifier_4mos
rename q40_5 lefthouse_4mos
rename q40_6 openedwindows_4mos
rename q40_7 boughtice_4mos
rename q40_8 coldshowers_4mos


replace centralac_4mos=0 if centralac_4mos !=1
label define centralac_3label 0 "no" 1 "yes"
label values centralac_4mos centralac_3label

replace windowac_4mos=0 if windowac_4mos !=1
label define windowac_3label 0 "no" 1 "yes"
label values windowac_4mos windowac_3label

replace fan_4mos=0 if fan_4mos !=1
label define fan_3label 0 "no" 1 "yes"
label values fan_4mos fan_3label

replace dehumidifier_4mos=0 if dehumidifier_4mos !=1
label define dehumidifier_3label 0 "no" 1 "yes"
label values dehumidifier_4mos dehumidifier_3label

replace lefthouse_4mos=0 if lefthouse_4mos !=1
label define lefthouse_3label 0 "no" 1 "yes"
label values lefthouse_4mos lefthouse_3label

replace openedwindows_4mos=0 if openedwindows_4mos !=1
label define openedwindows_3label 0 "no" 1 "yes"
label values openedwindows_4mos openedwindows_3label

replace boughtice_4mos=0 if boughtice_4mos !=1
label define boughtice_3label 0 "no" 1 "yes"
label values boughtice_4mos boughtice_3label

replace coldshowers_4mos=0 if coldshowers_4mos !=1
label define coldshowers_3label 0 "no" 1 "yes"
label values coldshowers_4mos coldshowers_3label


**binary variable representing whether a respondent used at least one strategy to stay cool in the last 5 months
gen staycool_4mos=.

replace staycool_4mos=0 if centralac_4mos==0 & windowac_4mos==0 & fan_4mos==0 & dehumidifier_4mos==0 & lefthouse_4mos==0 & openedwindows_4mos==0 & boughtice_4mos==0 & coldshowers_4mos==0


replace staycool_4mos=1 if centralac_4mos==1 | windowac_4mos==1 | fan_4mos==1 | dehumidifier_4mos==1 | lefthouse_4mos==1 | openedwindows_4mos==1 | boughtice_4mos==1 | coldshowers_4mos==1


label define staycool_4moslabel 0 "No coping strategies" 1 "At least one coping strategy"
label values staycool_4mos staycool_4moslabel


**did respondent indicate that they used air conditioning to stay cool
gen no_ac4=0
replace no_ac4=1 if centralac_4mos ==0 & windowac_4mos ==0
label define no_ac_label 0 "Used AC" 1 "Did not use AC"
label values no_ac4 no_ac_label

**if respondent did not use air conditioning, why not (don't have A/C, chose not to use, did not need it, or unit is not functioning)
rename q41 no_ac_reason4
label define noac_label 1 "Do not have air conditioning" 2 "Choose not to use it" 3 "Unit is not functioning" 4 "Did not need it"
label values no_ac_reason4 noac_label

**did respondent skip meals in the last 5 months and how often
rename q42 skipped_meals4
recode skipped_meals4 (2=0)
label define skipped_meals4label 0 "no" 1 "yes"
label values skipped_meals4 skipped_meals4label

rename q43 skipped_meals_frequency4

**Respondent could not pay a water bill
rename q45 water_bill4
recode water_bill4 (2=0)
label define water_bill4label 0 "no" 1 "yes"
label values water_bill4 water_bill4label

**The average cost of the household's water bill
rename q44 water_cost4


**respondent had their water shutoff
rename q46 water_shutoff4
recode water_shutoff4 (2=0)
label define water_shutoff4label 0 "no" 1 "yes"
label values water_shutoff4 water_shutoff4label


**respondent has a positive COVID diagnosis
gen covid_positive4=0
replace covid_positive4=1 if q47_1==1

**respondent reported having COVID symptoms
gen covid_symptoms4=0
replace covid_symptoms4=1 if q47_2==1

**How many doses of the vaccine has the respondent received
gen vaccine_doses=0
replace vaccine_doses=0 if Q_s2_s==1
replace vaccine_doses=1 if Q_s2_s==2
replace vaccine_doses=2 if Q_s2_s==3
replace vaccine_doses=3 if Q_s2_s==4
label define vacine_doses 0 "No doses" 1 "First dose, fully vaccinated" 2 "First does, scheduled for second" 3 "Two doses"
label values vaccine_doses vaccine_doseslabel

**respondent had their employment impacted by the COVID hsutdowns (reduced hours, furloughed, lost employment, re-entered the workforce, decided not to work, or no change in employment)
rename q48 covid_employment4
label define covid_employment4_label 1 "Reduced hours at job" 2 "Furloughed with pay" 3 "Furloughed without pay" 4 "Lost employment" 5 "Re-entered the workforce" 6 "Decided not to work" 7 "My employment status did not change" 8 "Other"
label values covid_employment4 covid_employment4_label

gen covid_lostjobhours4=0
replace covid_lostjobhours4=1 if covid_employment4==1 | covid_employment4==3 | covid_employment4==4

**Date that respondent lost employment
rename q49 date_unemployed4

**Did respondents health insurance change during COVID
rename q50 covid_insurance4
label define covid_insurance4_label 1 "Yes, I lost my health insurance" 2 "No, but my employed put me on a less generous plan" 3 "No, my health insurance plan is the same" 4 "I didn't have health insurance before COVID-19"
label values covid_insurance4 covid_insurance4_label

rename q51 month_lostinsurance4

**Did respondent experience economic hardships due to the pandemic, including: struggling to pay rent and energy bills, struggling to feed family, and struggling to receive medical care
rename q52 covid_energybill4
label define covid_bill4_label 1 "Strongly disagree" 2 "Somewhat disagree" 3 "Neither agree nor disagree" 4 "Somewhat agree" 5 "Strongly agree"
label values covid_energybill4 covid_bill4_label
rename q53 covid_rent4
label define covid_rent4_label 1 "Strongly disagree" 2 "Somewhat disagree" 3 "Neither agree nor disagree" 4 "Somewhat agree" 5 "Strongly agree"
label values covid_rent4 covid_rent4_label
rename q54 covid_feedfamily4
label define covid_feedfamily4_label 1 "Strongly disagree" 2 "Somewhat disagree" 3 "Neither agree nor disagree" 4 "Somewhat agree" 5 "Strongly agree"
label values covid_feedfamily4 covid_feedfamily4_label
rename q55 covid_medicalcare4
label define covid_medicalcare4_label 1 "Strongly disagree" 2 "Somewhat disagree" 3 "Neither agree nor disagree" 4 "Somewhat agree" 5 "Strongly agree"
label values covid_medicalcare4 covid_medicalcare4_label


**By which method does respondent pay their energy bill (check, credit, debit, bank withdrawal, or cash)?
rename q56_1 utilitypay_check4
recode utilitypay_check4 (2=0)
label define check_label 0 "no" 1 "yes"
label values utilitypay_check4 check_label
rename q56_2 utilitypay_credit4
recode utilitypay_credit4 (2=0)
label define credit_label 0 "no" 1 "yes"
label values utilitypay_credit4 credit_label
rename q56_3 utilitypay_debit4
recode utilitypay_debit4 (2=0)
label define debit_label 0 "no" 1 "yes"
label values utilitypay_debit4 debit_label
rename q56_4 utilitypay_withdrawal4
recode utilitypay_withdrawal4 (2=0)
label define withdrawal_label 0 "no" 1 "yes"
label values utilitypay_withdrawal4 withdrawal_label
rename q56_5 utilitypay_cash4
recode utilitypay_cash4 (2=0)
label define cash_label 0 "no" 1 "yes"
label values utilitypay_cash4 cash_label
rename q57 utilitybill_pay4
label define pay_label 1 "Pay it in full" 2 "Pay a portion of it" 3 "Pay it every other month or some other interval" 4 "Not pay it" 5 "Other"
label values utilitybill_pay4 pay_label

**What do respondents do when they cannot pay their utility bill (borrow from friends, take out a payday loan, use a credit card, or do not pay until they receive a disconnection notice)
rename q58_1 utilityhelp_friend4
recode utilityhelp_friend4 (2=0)
label define friend_label 0 "no" 1 "yes"
label values utilityhelp_friend4 friend_label
rename q58_2 utilityhelp_paydayloan4
recode utilityhelp_paydayloan4 (2=0)
label define paydayloan_label 0 "no" 1 "yes"
label values utilityhelp_paydayloan4 paydayloan_label
rename q58_3 utilityhelp_credit4
recode utilityhelp_credit4 (2=0)
label define utilitycredit_label 0 "no" 1 "yes"
label values utilityhelp_credit4 utilitycredit_label
rename q58_4 utilityhelp_notice4
recode utilityhelp_notice4 (2=0)
label define utilitynotice_label 0 "no" 1 "yes"
label values utilityhelp_notice4 utilitynotice_label

**Level of utility debt the household currently owes
rename q60 utility_debt4
recode utility_debt4 (1=0) (2=25) (3=50) (4=75) (5=100) (6=125) (7=150) (8=175) (9=200) (10=225) (11=250) (12=275) (13=300) (14=325) (15=350) (16=375) (17=400) (18=425) (19=450) (20=475) (21=500) (22=525) (23=550) (24=575) (25=600) (26=625) (27=650) (28=675) (29=700) (30=725) (31=750) (32=775) (33=800) (34=825) (35=850) (36=875) (37=900) (38=925) (39=950) (40=975) (41=1000) (42=1001)
label define utility_debt_label 0 "$0" 25 "$25" 50 "$50" 75 "$75" 100 "$100" 125 "$125" 150 "$150" 175 "$175" 200 "$200" 225 "$225" 250 "$250" 275 "$275" 300 "$300" 325 "$325" 350 "$350" 375 "$375" 400 "$400" 425 "$425" 450 "$450" 475 "$475" 500 "$500" 525 "$525" 550 "$550" 575 "$575" 600 "$600" 625 "$625" 650 "$650" 675 "$675" 700 "$700" 725 "$725" 750 "$750" 775 "$775" 800 "$800" 825 "$825" 850 "$850" 875 "$875" 900 "$900" 925 "$925" 950 "$950" 975 "$975" 1000 "$1000" 1001 "More than $1000"
label values utility_debt4 utility_debt_label

**Respondent has more than $1000 in utility debt
rename q61 debt_over10004
recode debt_over10004 (2=1)
label define over1000_label 1 "yes"
label values debt_over10004 over1000_label

**Are respondents behind on other payments (rent, credit cards, car payments, medical costs,bank loans, personal loans, or student loans?)
rename q62_1 behind_rent4
recode behind_rent4 (2=0)
label define behind_rentlabel 0 "no" 1 "yes"
label values behind_rent4 behind_rentlabel
rename q62_2 behind_credit4
recode behind_credit4 (2=0)
label define behind_creditlabel 0 "no" 1 "yes"
label values behind_credit4 behind_creditlabel
rename q62_3 behind_car4
recode behind_car4 (2=0)
label define behind_carlabel 0 "no" 1 "yes"
label values behind_car4 behind_carlabel
rename q62_4 behind_medical4
recode behind_medical4 (2=0)
label define behind_medicallabel 0 "no" 1 "yes"
label values behind_medical4 behind_medicallabel
rename q62_5 behind_bankloan4
recode behind_bankloan4 (2=0)
label define behind_bankloanlabel 0 "no" 1 "yes"
label values behind_bankloan4 behind_bankloanlabel
rename q62_6 behind_personalloan4
recode behind_personalloan4 (2=0)
label define behind_personalloanlabel 0 "no" 1 "yes"
label values behind_personalloan4 behind_personalloanlabel
rename q62_7 behind_studentloan4
recode behind_studentloan4 (2=0)
label define behind_studentloanlabel 0 "no" 1 "yes"
label values behind_studentloan4 behind_studentloanlabel


**Has respondent received a eviction notice in the last 5 months (February, March, April, May)
rename q63_1 evictnotice_february
recode evictnotice_february (2=0)
label define evictnotice_februarylabel 0 "no" 1 "yes"
label values evictnotice_february evictnotice_februarylabel
rename q63_2 evictnotice_march
recode evictnotice_march (2=0)
label define evictnotice_marchlabel 0 "no" 1 "yes"
label values evictnotice_march evictnotice_marchlabel
rename q63_3 evictnotice_april
recode evictnotice_april (2=0)
label define evictnotice_aprillabel 0 "no" 1 "yes"
label values evictnotice_april evictnotice_aprillabel
rename q63_4 evictnotice_may2
recode evictnotice_may2 (2=0)
label define evictnotice_may2label 0 "no" 1 "yes"
label values evictnotice_may2 evictnotice_may2label



gen evictnotice_4months=0
replace evictnotice_4months=1 if evictnotice_february==1
replace evictnotice_4months=2 if evictnotice_march==1
replace evictnotice_4months=3 if evictnotice_april==1
replace evictnotice_4months=4 if evictnotice_may==1
label define evictnotice_4months_label 0 "no" 1 "february" 2 "march" 3 "april" 4 "may2"
label values evictnotice_4months evicted_4months_label

**Has respondent been evicted in the last 4 months (February, March, April, May)
rename q64 evictmonth_4months
recode evictmonth_4months (5=0)

gen evicted_4months=0
replace evicted_4months =1 if evictmonth_4months > 0
label define evicted_label 0 "no" 1 "yes"
label values evicted_4months evicted_label


gen evicted_february=0
replace evicted_february=1 if evictmonth_4months==1
label define evicted_februarylabel 0 "no" 1 "yes"
label values evicted_february evicted_februarylabel

gen evicted_march=0
replace evicted_march=1 if evictmonth_4months==2
label define evicted_marchlabel 0 "no" 1 "yes"
label values evicted_march evicted_marchlabel

gen evicted_april=0
replace evicted_april=1 if evictmonth_4months==3
label define evicted_aprillabel 0 "no" 1 "yes"
label values evicted_april evicted_aprillabel

gen evicted_may2=0
replace evicted_may2=1 if evictmonth_4months==3
label define evicted_may2label 0 "no" 1 "yes"
label values evicted_may2 evicted_may2label


**has respondent sought legal help to deal with utility disconnection
rename q65 legal_help4
recode legal_help4 (2=0)
label define legalhelp_label 0 "no" 1 "yes"
label values legal_help4 legalhelp_label
rename q66 legal_access4
recode legal_access4 (2=0)
label define legalaccess_label 0 "no" 1 "yes"
label values legal_access4 legalaccess_label
rename q67 legal_source4
label define legalsource_label 1 "Hired a lawyer" 2 "Got help from a friend, family member, or other personal contact" 3 "An organization provided free legal service" 4 "Other"
label values legal_source4 legalsource_label


**how does respondent generally rate their health
rename q68 generalhealth_rate4
label define healthrate_label 1 "Excellent" 2 "Very good" 3 "Good" 4 "Fair" 5 "Poor" 6 "Don't know/notsure"
label values generalhealth_rate4 healthrate_label

**does a household member have a medical condition that requires prescription medication
rename q69 prescription4
recode prescription4 (2=0)
label define prescription_label 0 "no" 1 "yes"
label values prescription4 prescription_label

**if a household member requires prescription meidcation, have they not been able to fill that prescription in the last 3 months?
renam q70 fill_prescription4
recode fill_prescription4 (2=0)
label define fillprescript_label 0 "no" 1 "yes"
label values fill_prescription4 fillprescript_label

**In how many days over the last month did the respondent indicate that their mental health has been poor
rename q71 mentalhealth_days4
label define mentalhealth_label 0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8" 9 "9" 10 "10" 11 "11" 12 "12" 13 "13" 14 "14" 15 "15" 16 "16" 17 "17" 18 "18" 19 "19" 20 "20" 21 "21" 22 "22" 23 "23" 24 "24" 25 "25" 26 "26" 27 "27" 28 "28" 29 "29" 30 "30" 31 "Don't know/not sure"
label values mentalhealth_days4 mentalhealth_label

**Does respondent have various health consitions
gen highbloodpressure4=0
replace highbloodpressure4=1 if q71a==1
label define highpressure_label 0 "no" 1 "yes"
label values highbloodpressure4 highpressure_label
gen heartdisease4=0
replace heartdisease4=1 if q71b==1
label define heartdisease_label 0 "no" 1 "yes"
label values heartdisease4 heartdisease_label
gen diabetes4=0
replace diabetes4=1 if q71c==1
label define diabetes_label 0 "no" 1 "yes"
label values diabetes4 diabetes_label
gen cancer4=0
replace cancer4=1 if q71d==1
label define cancer_label 0 "no" 1 "yes"
label values cancer4 cancer_label
gen obesity4=0
replace obesity4=1 if q71e==1
label define obesity_label 0 "no" 1 "yes"
label values obesity4 obesity_label
gen asthma4=0
replace asthma4=1 if q71f==1
label define asthma_label 0 "no" 1 "yes"
label values asthma4 asthma_label





***************************Cleaning up variables*******************************
*employment status
gen employed4 = 0
replace employed4 = 0 if employ >1
replace employed4 = 1 if employ <3
label var employed4 "employed?"
label define employedlabel 0 "no" 1 "yes"
label values employed4 employedlabel

gen unemployed4 =0
replace unemployed4 =1 if employ==3 | employ==4
label var unemployed4 "unemployed"
label define unemployed4label 0 "no" 1 "yes"
label values unemployed4 unemployed3label

rename employ employ4

*lost insurance due to COVID*
gen covid_lostinsurance4=.
replace covid_lostinsurance4=0 if covid_insurance4==2 | covid_insurance4==3 | covid_insurance4 ==4
replace covid_lostinsurance4=1 if covid_insurance4==1
label define lostinsurance 0 "Did not lose insurance" 1 "Lost Insurance"
lab val covid_lostinsurance4 lostinsurance

**high school degree or less
gen educ_HS4 = (educ4==1|educ4==2)
label var educ_HS4 "respondent has high school degree or less"
label define educ_HS_label 0 "No" 1 "Yes"
label values educ_HS4 educ_HS_label

**any children under 5
gen any_under54 = (hh_under54>0)
recode any_under54 *=. if hh_under54==.
label var any_under54 "at least one person in the house is under 5"
label define any_label 0 "No" 1 "Yes"
label values any_under54 any_label

**any household members over 65
gen any_over654 = (hh_over654>0)
recode any_over654 *=. if hh_over654==.
label var any_over654 "at least one person in the house is over 65"
label define any_over_label 0 "No" 1 "Yes"
label values any_over654 any_over_label

**Lost work due to COVID
gen covid_lostwork4 = (covid_employment4==1|covid_employment4==3|covid_employment4==4)
recode covid_lostwork4 *=. if covid_employment4==.
label var covid_lostwork4 "Respondent lost work pay or hours due to the pandemic"
label define lostwork_label 0 "No" 1 "Yes"
label values covid_lostwork4 lostwork_label

**no or worse insurance due to COVID
gen covid_lessinsurance4 = (covid_insurance4==1| covid_insurance4==2)
recode covid_lessinsurance4 *=. if covid_insurance4==.
label var covid_lessinsurance4 "respondent lost health insurance or employer put them on less generous plan"
label define less_insure_label 0 "No" 1 "Yes"
label values covid_lessinsurance4 less_insure_label

gen no_insurance4 = (covid_insurance4==1|covid_insurance4==4)
recode no_insurance4 *=. if covid_insurance4==.
label var no_insurance4 "respondent lost insurance or didn't have any to begin with"
label define no_insure_label 0 "No" 1 "Yes"
label values no_insurance4 no_insure_label

**any household memebrs with a disability
gen any_disability4 = (hh_disability4>0)
recode any_disability4 *=. if hh_disability4==.
label var any_disability4 "at least one person in the house has a disability"
label define any_disability_label 0 "No" 1 "Yes"
label values any_disability4 any_disability_label

**respondent lives in a trailer or mobile home
gen home_trailer4 = (dwelling_type4==1)
recode home_trailer4 *=. if dwelling_type4==.
label var home_trailer4 "respondent's home is trailer or mobile home"
label define home_trailer_label 0 "No" 1 "Yes"
label values home_trailer4 home_trailer_label

**respondent lives in an apartment, duplex, or condo
gen home_apartmentcondo4 = (dwelling_type4==2)
recode home_apartmentcondo4 *=. if dwelling_type4==.
label var home_apartmentcondo4 "respondent's home is apartment, duplex, or condo"
label define home_apartmentcondo_label 0 "No" 1 "Yes"
label values home_apartmentcondo4 home_apartmentcondo_label

**respondent lives in a single family home
gen home_singlefam4 = (dwelling_type4==3|dwelling_type4==4)
recode home_singlefam4 *=. if dwelling_type4==.
label var home_singlefam4 "respondent's home is a single family home, either attached or detached"
label define home_singlefam_label 0 "No" 1 "Yes"
label values home_singlefam4 home_singlefam_label


**respondent indicated "other" as their dwelling type
gen home_other4 = (dwelling_type4==5)
recode home_other4 *=. if dwelling_type4==.
label var home_other4 "respondent's home is recorded as other"
label define home_other_label 0 "No" 1 "Yes"
label values home_other4 home_other_label


***respondent makes irregular utility payments
gen utilitybill_pay_irregular4 = (utilitybill_pay4==2|utilitybill_pay4==3|utilitybill_pay4==4)
recode utilitybill_pay_irregular4 *=. if utilitybill_pay4==.
label var utilitybill_pay_irregular4 "respondent pays portion of bill, every other bill, or doesn't pay"
label define irregular_label 0 "No" 1 "Yes"
label values utilitybill_pay_irregular4 irregular_label

**respondent has over $100 in utility debt
gen utilitydebt_over1004 = (utility_debt4>100)
recode utilitydebt_over1004 *=. if utility_debt4==.
label var utilitydebt_over1004 "respondent owes more than $100 in debt to utility"
label define over100_label 0 "No" 1 "Yes"
label values utilitydebt_over1004 over100_label

**respondent indicated their general health status was good to great
gen genhealth_goodtogreat4 = (generalhealth_rate4==1|generalhealth_rate4==2|generalhealth_rate4==3)
recode genhealth_goodtogreat4 *=. if generalhealth_rate4==.
label var genhealth_goodtogreat4 "respondent reports good, very good, or excellent overall health"
label define goodgreat_label 0 "No" 1 "Yes"
label values genhealth_goodtogreat4 goodgreat_label


**rename open responses
rename employ_t employmentstatus_open4
rename q59_open maintainbills_open4
rename q61_open debt_over1000_open4
rename q71_other chronic_conditions_open4
rename q49_other covid_employmentchange_open4
rename q57_other utilitybillpay_open4
rename q58_other utilitybillhelp_open4
rename q56_other utilitypaymethod_open4
rename q39_other staycool_open4
rename q38_other staywarm_open4
rename q33_other govassist_open4
rename q30_other energyassist_open4
rename q22_other response_notice_open4
rename q14_other energyefficiency_open4




****FPL levels (numeric)****
gen hhinc4 = "100% FPL or below" if hh1_income4==1
forvalues i = 2(1)8 {
replace hhinc4 = "100% FPL or below" if hh`i'_income4==1
}
forvalues i = 1(1)8 {
replace hhinc4 = "100%-150% FPL" if hh`i'_income4==2 | hh`i'_income4==3
}
forvalues i = 1(1)8 {
replace hhinc4 = "150%-200% FPL" if hh`i'_income4==4 | hh`i'_income4==5
}
forvalues i = 1(1)8 {
replace hhinc4 = "Over 200% FPL" if hh`i'_income4==6
}
encode hhinc4, gen(fpl4)


***Income levels by FPL***
gen under_100_fpl4=.
replace under_100_fpl4=0 if fpl4==2 | fpl4==3 | fpl4==4
replace under_100_fpl4=1 if fpl4==1

gen FPL_100_1504=.
replace FPL_100_1504=0 if fpl4==1 | fpl4==3 | fpl4==4
replace FPL_100_1504=1 if fpl4==2

gen FPL_150_2004=.
replace FPL_150_2004=0 if fpl4==1 | fpl4==2 | fpl4==4
replace FPL_150_2004=1 if fpl4==3

gen FPL_over_2004=.
replace FPL_over_2004=0 if fpl4==1 | fpl4==2 | fpl4==3
replace FPL_over_2004=1 if fpl4==4



gen white=0
replace white=1 if race==1

gen black=0
replace black=1 if race==2

gen hispanic=0
replace hispanic=1 if race==3

gen native_american=0
replace native_american=1 if race==5

gen female=0
replace female=1 if gender==2

gen age = 2020-birthyr

gen wave4=1

*****Merge zip code, urban vs rural percentage*****
sort inputzip
merge m:1 inputzip using zcta_urban_v2.dta
drop if _m==2
rename inputzip inputzip4


save CLEAN_wave4.dta, replace